package com.berchen.exception;

import com.berchen.common.result.ResultEnum;

/**
 * 自定义全局异常类
 * @author chenwanhao
 */
public class ZdyException extends RuntimeException{

    private Integer code;
    private String msg;

    public ZdyException(String message, Integer code) {
        super(message);
        this.msg=message;
        this.code = code;
    }

    public ZdyException(ResultEnum resultEnum){
        super(resultEnum.getMsg());
        this.msg= resultEnum.getMsg();
        this.code=resultEnum.getCode();
    }

    @Override
    public String toString() {
        return "ZdyException{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                '}';
    }
}
